<!DOCTYPE html>
<html>
{% extends "base.html" %}
{% load custom_markdown %}
{% load django_markdown %}

<body>
	{% block content %}
	<div class="page-container">
		<div class="row breadcrumbs margin-bottom-40">
            <div class="container">
                <div class="col-md-4 col-sm-4">
                    <h1>Blog Page</h1>
                </div>
                <div class="col-md-8 col-sm-8">
                    <ul class="pull-right breadcrumb">
                        <li><a href="/">主页</a></li>
                        <li><a href="">Pages</a></li>
                        <li class="active">Blog Page</li>
                    </ul>
                </div>
            </div>
        </div><!-- end breadcrumbs -->
        <div class="container min-hight">
        	<div class="row">
        		<div class="col-md-9 col-sm-9 blog-posts margin-bottom-40">
        		 {% for post in post_list %}
        			<div class="row">
        			<div class="col-md-4 col-sm-4">
							<img src="{{ STATIC_URL }}img/img4.jpg" alt="" class="img-responsive">
					</div>
						<div class="col-md-8 col-sm-8">
						<h2>
							<a href="{% url 'detail' id=post.id %}">{{ post.title }}</a>
						</h2>
							<ul class="blog-info">
								<li><i class="fa fa-calendar"></i> {{ post.date_time|date:'Y/m/d' }}</li>
								<li><i class="fa fa-eye"></i> {{post.read_count}}</li>
								<li><i class="fa fa-archive"></i>
								 {% for category in post.categories.all %}
								<a href="{{category.get_absolute_url}}">{{ category.name }}</a>
								{% if not forloop.last %}, {% endif %}
								{% endfor %}
								</li>
								<li><i class="fa fa-tags"></i>
								 {% for tag in post.tags.all %}
								<a href="{{tag.get_absolute_url}}">{{ tag.name }}</a>
								{% if not forloop.last %}, {% endif %}
								{% endfor %}
								</li>
							</ul>
							<p> {{ post.content|markdown|truncatewords_html:10}}</p>
							<a class="more" href="{% url 'detail' id=post.id %}">Read more <i class="icon-angle-right"></i></a>
						</div>
        			</div><!--end  row end loop-->
        			<hr class="blog-post-sep">
        			 {% endfor %}
        			 	<nav>
    		{% if post_list.object_list and post_list.paginator.num_pages > 1 %}
  
    		<ul class="pager">
    		{% if post_list.has_previous %}
    		<li><a href="?page={{post_list.previous_page_number}}">上一页</a></li>
    		{% endif %}
    		{% if post_list.has_next %}
    		 <li><a href="?page={{ post_list.next_page_number }}">下一页</a></li>
    		{% endif %}
    		</ul>
   			 {% endif %}
            
          </nav>
        			 
        		</div><!-- end margin-bottom-40 -->
        		<div class="col-md-3 col-sm-3 blog-sidebar">
        		<h3>分类目录</h3>
        		<ul class="nav margin-bottom-40">
						 {% for category in category_lsit %}
						 	<li><a href="{{category.get_absolute_url}}"><i class="fa fa-angle-right"></i>{{category.name}}</a></li>
						{%endfor%}
					</ul>
        			<div class="blog-tags margin-bottom-20">
						<h4>标签</h4>
						<ul>
						 {% for tag in tag_list %}
							<li><a href="{{tag.get_absolute_url}}"><i class="fa fa-tags"></i>{{tag.name}}</a></li>
							{%endfor%}
						</ul>
					</div>
        		</div>
        	
        	</div>
        </div><!--end  container -->
	
	</div><!-- end page-container -->
{% endblock %}
</body>
</html>